package com.distribute.core.core;

import com.distribute.core.enums.NotifyFlushType;

import java.io.Serializable;

/**
 * 数据参数标志属性类
 *
 * @author chennengcheng
 * @date 2021-09-15 10:18
 * @remark
 */
public class BaseNotifyMessage implements Serializable {

    /**
     * 传输更新数据
     */
    private String data;

    private String modelPrefix;

    private String model;

    private NotifyFlushType notifyFlushType;


    public String getModelPrefix() {
        return modelPrefix;
    }

    public void setModelPrefix(String modelPrefix) {
        this.modelPrefix = modelPrefix;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public NotifyFlushType getNotifyFlushType() {
        return notifyFlushType;
    }

    public void setNotifyFlushType(NotifyFlushType notifyFlushType) {
        this.notifyFlushType = notifyFlushType;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public static BaseNotifyMessage buildNotifyAll() {
        BaseNotifyMessage baseNotifyMessage = new BaseNotifyMessage();
        baseNotifyMessage.setNotifyFlushType(NotifyFlushType.ALL);
        return baseNotifyMessage;
    }

    public static BaseNotifyMessage buildNotifyPart(String data) {
        BaseNotifyMessage baseNotifyMessage = new BaseNotifyMessage();
        baseNotifyMessage.setData(data);
        baseNotifyMessage.setNotifyFlushType(NotifyFlushType.PART);
        return baseNotifyMessage;
    }
}
